/**
 * 
 */
package com.nextive.interview.service.impl;

import android.content.Context;
import android.database.Cursor;

import com.nextive.interview.dao.WeightInfoDao;
import com.nextive.interview.dao.sqlite.SqLiteWeightInfoDao;
import com.nextive.interview.service.WeightInfoService;

/**
 * This class is intended to use as a service to 
 * obtain all information involved in each view.
 * @author Martin
 *
 */
public class WeightInfoServiceImpl implements WeightInfoService {

	private WeightInfoDao weightInfoDao;
	
	public WeightInfoServiceImpl(Context context) {
		
		this.weightInfoDao = new SqLiteWeightInfoDao(context);
		
	}
	
	public Cursor generateEditWeightHistoryCursor(long id) {
		
		return weightInfoDao.fetchWeightHistoryInfo(id);
		
	}

	public Cursor generateViewAllWeightHistoryCursor() {
		
		return weightInfoDao.fetchAllWeighHistoryInfo();
		
	}
	
	// TODO - implement this ? remove this ?
	public Cursor generateShareWeightCursor() {
		
		return null;
		
	}

	@Override
	public boolean deleteWeightInfo(long id) {
		
		return weightInfoDao.deleteWeightInfo(id);
		
	}

	@Override
	public long createNewWeightEntry(String weight, String date) {
		
		return weightInfoDao.createNewWeightInfo(weight, date);
		
	}

	@Override
	public boolean updateWeightInfo(long id, String weight, String date) {
		
		return weightInfoDao.updateWeightInfo(id, weight, date);
		
	}

}
